﻿using HMS.TenantServer.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace HMS.TenantServer.Configurations;

internal class TenantConfiguration : IEntityTypeConfiguration<Tenant>
{
    public void Configure(EntityTypeBuilder<Tenant> builder)
    {
        builder
            .HasKey(x => x.Id);

        builder
            .HasMany(x => x.Users)
            .WithOne(x => x.Tenant)
            .OnDelete(DeleteBehavior.Cascade);
    }
}